Skip to content

[action-translation] resync: mle.md#136

Merged
mmcky merged 4 commits into
mainfrom
resync/mle
Jul 19, 2026
Merged

[action-translation] resync: mle.md#136
mmcky merged 4 commits into
mainfrom
resync/mle

Conversation

@mmcky

@mmcky mmcky commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Forward Resync: mle.md

Source: QuantEcon/lecture-python.mystlectures/mle.md
Source commit: 0bfcac8
This PR resyncs the translation to match the current source document.

Reason: The target uses an entirely different (older) code implementation based on NumPy/SciPy/statsmodels instead of JAX (no jax.grad, jax.jacfwd, jax.vmap, NamedTuple classes), missing the GPU admonition include, missing prerequisites imports like gammaln, and uses class-based PoissonRegression/ProbitRegression with different method structures instead of functional JAX approach. It also lacks the jax-specific explanation of jax.grad/vmap/jacfwd/jacrev usage and documentation references. These represent substantive content/code differences requiring re-translation, not just style differences.

Changes

Whole-file resync applied. The entire document was resynced in a single pass.


Created by action-translation forward resync

Copilot AI review requested due to automatic review settings July 18, 2026 08:22
@mmcky mmcky added action-translation-sync Auto-created by action-translation resync Forward resync labels Jul 18, 2026
@netlify

netlify Bot commented Jul 18, 2026

Copy link
Copy Markdown

Deploy Preview for astonishing-narwhal-a8fc64 ready!

Name Link
🔨 Latest commit d4adc44
🔍 Latest deploy log https://app.netlify.com/projects/astonishing-narwhal-a8fc64/deploys/6a5c194a6aa5cb00083e002b
😎 Deploy Preview https://deploy-preview-136--astonishing-narwhal-a8fc64.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR forward-resyncs the Chinese translation of lectures/mle.md to match the upstream lecture-python.myst source, updating both narrative and code examples (notably shifting the MLE implementation toward a JAX-based workflow) and recording sync state metadata for the translation tool.

Changes:

  • Resynced lectures/mle.md content to upstream, including adding the GPU admonition include and updating code cells to use JAX (jax.grad, jax.vmap, jax.jacfwd) alongside statsmodels examples.
  • Added translation frontmatter (translation.title and translation.headings) for structured heading mapping.
  • Added .translate/state/mle.md.yml to record source SHA and resync metadata.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
lectures/mle.md Full-document resync: adds translation metadata + GPU include, replaces older NumPy/SciPy/statsmodels-only workflow with JAX-based autodiff examples, and updates surrounding text/plots accordingly.
.translate/state/mle.md.yml Records resync provenance (source SHA/date/model/mode) for the translation pipeline.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lectures/mle.md
Comment on lines 60 to +64
import numpy as np
from numpy import exp
from scipy.special import factorial
import jax.numpy as jnp
import jax
import pandas as pd
from mpl_toolkits.mplot3d import Axes3D
import statsmodels.api as sm
from typing import NamedTuple
Comment thread lectures/mle.md
def logL(β, model):
y = model.y
μ = jnp.exp(model.X @ β)
return jnp.sum(model.y * jnp.log(μ) - μ - jnp.log(factorial(y)))
Comment thread lectures/mle.md
return jnp.sum(model.y * jnp.log(μ) - μ - jnp.log(factorial(y)))
```

为了求出`poisson_logL`的梯度,我们再次使用[jax.grad](https://jax.readthedocs.io/en/latest/_autosummary/jax.grad.html)。
Comment thread lectures/mle.md
H_logL = jax.jacfwd(G_logL)
```

我们的函数`newton_raphson`将接收一个`PoissonRegression`对象,该对象包含参数向量$\boldsymbol{\beta}_0$的初始猜测值。
Comment thread lectures/mle.md
Comment on lines 523 to 526
if display:
β_list = [f'{t:.3}' for t in list(model.β.flatten())]
update = f'{i:<13}{model.logL():<16.8}{β_list}'
β_list = [f"{t:.3}" for t in list(β.flatten())]
update = f"{i:<13}{logL(β, model):<16.8}{β_list}"
print(update)
Comment thread lectures/mle.md Outdated
Comment on lines +700 to +704
reg_names = ["Model 1", "Model 2", "Model 3"]
info_dict = {
"Pseudo R-squared": lambda x: f"{x.prsquared:.2f}",
"No. observations": lambda x: f"{int(x.nobs):d}",
}
Comment thread lectures/mle.md
Comment on lines +732 to +735
results_table.add_title(
"Table 1 - Explaining the Number of Billionaires \
in 2008"
)
Re-applies Chinese code comments / print strings / plot labels that the
resync reverted to English while the surrounding code is unchanged
(action-translation#107 field validation, Track B wave).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmcky mmcky added the action-translation PRs created by QuantEcon/action-translation label Jul 18, 2026
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

@github-actions
github-actions Bot temporarily deployed to pull request July 18, 2026 10:29 Inactive
The resynced file keeps Chinese plot labels but reverted the import
cell to the source's exact form, losing the Source Han Serif setup -
Chinese in figures would render as missing glyphs. Residual #107
class found in the merge review; applied wave-wide.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

✅ Translation Quality Review

Verdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-19


📝 Translation Quality

Criterion Score
Accuracy 8/10
Fluency 8/10
Terminology 8/10
Formatting 8/10
Overall 8/10

Summary: The whole-file resync is largely accurate and fluent, correctly preserving code, math, and structure. A few sections show paraphrasing or added interpretive content instead of direct translation (particularly in the regression results discussion and predicted-vs-actual analysis), and one sentence about 'family of distributions' is garbled and should be corrected for clarity. Overall terminology usage aligns well with the glossary. Mathematical notation and LaTeX equations are accurately preserved throughout the resynced document Code blocks remain intact and unmodified, including comments appropriately translated to Chinese Technical terms like 最大似然估计, 泊松回归, 牛顿-拉夫森算法, 海森矩阵 are used consistently and correctly per the glossary The translation metadata (translation/headings) is properly structured for cross-referencing the resynced document

Suggestions:

  • Section '每个分布族都由有限个参数索引的分布家族': This sentence is garbled/incomplete - 'Each such class is a family of distributions indexed by a finite number of parameters' should read as '每个这样的类都是由有限个参数索引的一个分布族' rather than the current confusing repetition of '分布族...分布家族'
  • Section on Poisson regression estimation: 'Let's also estimate the author's more full-featured models and display them in a single table' was translated as '让我们继续估计作者提出的两个更复杂的模型,并将三个模型的结果并排展示以便比较' - this adds interpretive detail (mentioning '两个' and '三个') not present in the source; consider a more literal rendering like '让我们也估计作者更完整的模型,并将它们显示在同一个表格中'
  • Section describing regression results: The source states results are 'positively correlated with GDP per capita, population size, stock market capitalization, and negatively correlated with top marginal income tax rate' but the translation restructures this into two sentences with added phrasing ('结果显示,一个国家的亿万富翁数量会随着...' and '相反,较高的最高边际所得税率会降低...') - while conveying similar meaning, this is a paraphrase rather than a direct translation; consider closer alignment with source phrasing for consistency
  • Section on comparing predicted vs actual: 'To analyze our results by country, we can plot the difference...' was translated with added interpretive framing ('为了更好地理解各国的具体情况,我们来看看...') rather than a direct translation; consider a more literal version closer to '为了按国家分析我们的结果,我们可以绘制预测值和实际值之间的差异...'

🔍 Diff Quality

Check Status
Scope Correct
Position Correct
Structure Preserved
Heading-map Correct
Overall 10/10

Summary: The target document was correctly resynced to match the current source structure, content, and code cells, with an accurate translation heading map added to frontmatter.


This review was generated automatically by action-translation review mode.

@github-actions
github-actions Bot temporarily deployed to pull request July 18, 2026 11:31 Inactive
The hand-restoration of localised code lines grabbed the wrong line of
a print pair from the old pre-JAX lecture: the newton_raphson routine
printed the iteration count twice and never printed the beta_hat
estimate the following prose relies on. Restored upstream's second
print line (using the new JAX-local beta). Also adds the missing
trailing newline (engine issue tracked in QuantEcon/action-translation#116).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions
github-actions Bot temporarily deployed to pull request July 19, 2026 00:48 Inactive
@mmcky
mmcky merged commit db25065 into main Jul 19, 2026
7 checks passed
@mmcky
mmcky deleted the resync/mle branch July 19, 2026 00:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action-translation PRs created by QuantEcon/action-translation action-translation-sync Auto-created by action-translation resync Forward resync

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants